﻿using FileManagerSystem.Middleware;
using Microsoft.AspNetCore.Builder;

namespace FileManagerSystem.Extend
{
    /// <summary>
    /// 功能描述: netCore容器扩展
    /// </summary>
    public static class CoreServiceExtend
    {
        /// <summary>
        /// 全局异常捕获中间件
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public static IApplicationBuilder UseGlobalExceptionMiddleware(this IApplicationBuilder app)
        {
            return app.UseMiddleware<GlobalExceptionMiddleware>();
        }

        /// <summary>
        /// 全局日志记录中间件
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public static IApplicationBuilder UseApiLogMiddleware(this IApplicationBuilder app)
        {
            return app.UseMiddleware<ApiLogMiddleware>();
        }
    }
}
